/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;


@Entity
@DiscriminatorValue("Vaccine")
public class Vaccine implements Serializable {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO) //create prymary key id
    private Long id;
    @Column(nullable = false)
    private String name;
    @Column(nullable = false)
    private float dosage;
    
    @ManyToOne
    @JoinColumn(name = "MedicalRecord_fk")
    private MedicalRecord medicalRecord; //Many vaccines has One medical medicalRecord
   
    public Vaccine() {
        this.name = "NN";
        this.dosage = 0;
        this.medicalRecord = null;
    }

    public Vaccine(String name, float dosage, MedicalRecord record) {
        this.name = name;
        this.dosage = dosage;
        this.medicalRecord = record;
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }public String getName() {
        return name;
    }

    public float getDosage() {
        return dosage;
    }

    public void setDosage(Long dosage) {
        this.dosage = dosage;
    }
    
    @Override
    public String toString(){
        return name+"- Dosage "+dosage+"\n";
    }
}
